import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HealthRecordVO, HealthRecordForm, HealthRecordQuery } from '@/api/nursing/healthRecord/types';

/**
 * 查询健康信息管理列表
 * @param query
 * @returns {*}
 */

export const listHealthRecord = (query?: HealthRecordQuery): AxiosPromise<HealthRecordVO[]> => {
  return request({
    url: '/nursing/healthRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询健康信息管理详细
 * @param recordId
 */
export const getHealthRecord = (recordId: string | number): AxiosPromise<HealthRecordVO> => {
  return request({
    url: '/nursing/healthRecord/' + recordId,
    method: 'get'
  });
};

/**
 * 新增健康信息管理
 * @param data
 */
export const addHealthRecord = (data: HealthRecordForm) => {
  return request({
    url: '/nursing/healthRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改健康信息管理
 * @param data
 */
export const updateHealthRecord = (data: HealthRecordForm) => {
  return request({
    url: '/nursing/healthRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除健康信息管理
 * @param recordId
 */
export const delHealthRecord = (recordId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/healthRecord/' + recordId,
    method: 'delete'
  });
};
